import org.tmatesoft.svn.core.*;
import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;

import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions;
import org.tmatesoft.svn.core.wc.*;

import java.io.File;
import java.util.Collections;


public class Merging {
	
	public static void main(String arg[]){
		try{
		 DAVRepositoryFactory.setup();
		 //SVNRepositoryFactoryImpl.setup();
		 //FSRepositoryFactory.setup(); 

		 SVNURL url1 = SVNURL.parseURIEncoded("https://example-test-project.googlecode.com/svn/branches/Checkout");

         File dstPath = new File("C:/CheckoutTrunk");
         
         dstPath.mkdirs();

         
		DefaultSVNOptions options = SVNWCUtil.createDefaultOptions(true);
		String name = "Hapinerosa@gmail.com";
		String password = "YX7zv8aU9Qd9";
		SVNRevisionRange rangeToMerge = new SVNRevisionRange(SVNRevision.create(1), SVNRevision.HEAD);

        SVNDiffClient diffClient = SVNClientManager.newInstance(options, name, password).getDiffClient();
 
		diffClient.doMerge(url1, SVNRevision.HEAD, Collections.singleton(rangeToMerge), dstPath, SVNDepth.UNKNOWN, true, false, false, false);
        }catch(SVNException e){
			System.out.println(e);
		}
	}

}
